//
//  UIWindow+CZExtenWindow.m
//  CZOC微博01
//
//  Created by 1 on 15/12/2.
//  Copyright © 2015年 itcast. All rights reserved.
//

#import "UIWindow+CZExtenWindow.h"
#import "CZTabbarController.h"
#import "CZFeatherViewController.h"
//#import "CZOAuthViewController.h"
@implementation UIWindow (CZExtenWindow)
- (void)switchRootViewController
{
   
//    UIWindow *window=[UIApplication sharedApplication].keyWindow;
    NSString *key=@"CFBundleVersion";
    
    NSUserDefaults *userSet=[NSUserDefaults  standardUserDefaults];
    NSString * bundle=[userSet objectForKey:key];
    
    
    //获取当前的bundle
    NSString *currentBundle=[NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
    if([currentBundle isEqualToString:bundle])
    {
        CZTabbarController *tabbar=[[CZTabbarController alloc]init];
        self.rootViewController=tabbar;
        
    }else
    {
        CZFeatherViewController *newFeather=[[CZFeatherViewController alloc] init];
       self.rootViewController=newFeather;
        [[NSUserDefaults standardUserDefaults] setObject:currentBundle forKey:key];
        
        
    }
}
@end
